<?php
/**
  * ZERO
  *
  * This is not a freeware, use is subject to license terms
  * @author ZERO DEV TEAM
  * 
  */
if ( !defined( "IN_CLOUD" ) ) exit ( 'Access Denied!' );

class PictureTagRelation extends Model
{
	
	private static $object;
	
	private function PictureTagRelation()
	{
		$this->tableName = 'pinfo_ptag_relation';
		parent::__construct();
	}
	
	public static function getInstance()
	{
		if ( !is_object( self::$object ) )
		{
			self::$object = new self();
		}
		return self::$object;
	}
	
	/**
	 * 添加图片和标签记录
	 * @param int $picId
	 * @param array $tagArr
	 */
	public function addPicTagRelation( $picId , $tagArr )
	{
		foreach( $tagArr as $tagId )
		{
			$this->insert( array( 'pid' => $picId , 'ptid' => $tagId ) );
		}
	}
	
}